package com.olive.fallback;

import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;

import com.olive.dto.Order;
import com.olive.remote.OrderServiceRemoteApi;

@Component
public class ServiceRemoteApiFallback implements FallbackFactory<OrderServiceRemoteApi> {

	@Override
	public OrderServiceRemoteApi create(Throwable cause) {

		return new OrderServiceRemoteApi() {

			@Override
			public Order findById(Integer id) {
				Order order = new Order();
				order.setId(-1);
				return order;
			}

		};
	}
}